



#ifndef _PDF_FONT_H_
#define _PDF_FONT_H_

#include <wx/mstream.h>

#include "wx/pdfdocdef.h"
#include "wx/pdffontdescription.h"
#include "wx/pdfproperties.h"

class WXDLLIMPEXP_FWD_PDFDOC wxPdfEncoding;
class WXDLLIMPEXP_FWD_PDFDOC wxPdfFontData;

/// Class representing a font providing a basic interface
class WXDLLIMPEXP_PDFDOC wxPdfFont
{
public :
  /// Default constructor
  wxPdfFont() ;

  /// Default destructor
  virtual ~wxPdfFont() ;

  /// Copy constructor
  wxPdfFont(const wxPdfFont& font);

  /// Assignment
  wxPdfFont& operator=(const wxPdfFont& font);

  /// Check whether font is valid
  
  bool IsValid() const;

  /// Get font type
  
  wxString GetType() const;

  /// Get font family
  
  wxString GetFamily() const;

  /// Get font name
  
  wxString GetName() const;

  /// Get font style
  
  int GetStyle() const;

  /// Get encoding
  
  wxString GetEncoding() const;

  /// Get the width of a string
  
  virtual double GetStringWidth(const wxString& s) const;

  /// Check whether the font embedding is required
  
  bool EmbedRequired() const;

  /// Check whether the font embedding is supported
  
  bool EmbedSupported() const;

  /// Check whether the font subsetting is supported
  
  bool SubsetSupported() const;

  /// Get the font description
  
  const wxPdfFontDescription GetDescription() const;

  /// Set embed flag
  
  void SetEmbed(bool embed);

  /// Get embed flag
  
  bool GetEmbed() const { return m_embed; }

  /// Set subset flag 
  
  void SetSubset(bool subset);

  /// Get subset flag
  
  bool GetSubset() const { return m_subset; }

  /// Set encoding
  
  bool SetEncoding(const wxString& encodingName);

  /// Get encoding
  
  bool GetEncoding(wxPdfEncoding& encoding);

  /// Check whether the font oan show all characters of a given string
  
  bool CanShow(const wxString& s);

  /// Get list of supported unicode characters
  
  bool GetSupportedUnicodeCharacters(wxPdfArrayUint32& unicodeCharacters) const;

  /// Force string to valid string in respect of the current font encoding
  
  wxString ConvertToValid(const wxString& s, wxChar replace = wxT('?')) const;

  /// Get list of supported glyph names
  
  bool GetGlyphNames(wxArrayString& glyphNames) const;

private:
  /// Constructor creating a reference to the real font data
  wxPdfFont(wxPdfFontData* fontData, int fontStyle = wxPDF_FONTSTYLE_REGULAR);

  bool                 m_embed;     ///< Flag whether the font should be embedded
  bool                 m_subset;    ///< Flag whether the font should be subsetted
  int                  m_fontStyle; ///< Font style flags
  wxPdfFontData*       m_fontData;  ///< Real font data
  const wxPdfEncoding* m_encoding;  
  friend class wxPdfFontExtended;
  friend class wxPdfFontManagerBase;
};

#endif
